/*
 * @Description:
 * @Author: LCL
 * @Date: 2021-11-23
 * @LastEditors: LCL
 * @LastEditTime: 2021-11-26
 * @FilePath: /beff/src/pages/ApprovalList/service.ts
 */
import { request } from 'umi';
import { getCookie } from '@/utils/utils';

export async function getTypeCount(userId: string): Promise<API.IResponse<any>> {
  const token = getCookie('token');
  return request(`/bpm/api/v1/process/count/${userId}`, {
    headers: {
      Authorization: `Bearer ${token}`,
    },
  });
}

export async function queryList(
  data: any,
  type: string,
  pn: number,
  ps: number,
): Promise<API.IResponsePage<any>> {
  const token = getCookie('token');
  return request(`/bpm/api/process/${type}/${pn}/${ps}`, {
    method: 'POST',
    data: JSON.stringify(data),
    headers: {
      Accept: 'application/json, text/plain',
      'Content-Type': 'application/json',
      Authorization: `Bearer ${token}`,
    },
  });
}
